package com.sicent.operate.common.db.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sicent.operate.common.datasource.DataSource;
import com.sicent.operate.common.db.dao.UserDao;
import com.sicent.operate.common.db.model.User;
import com.sicent.operate.common.droppoint.HashAlgorithmUtil;
import com.sicent.operate.common.droppoint.TableType;

@Service
@DataSource(fixed=false,value="USER_INFO")
public class UserService {

	@Autowired
	private UserDao userDao;
	
	public User findUserById(Integer userId){
		String tableNode = HashAlgorithmUtil.hashTable(String.valueOf(userId), TableType.USER_INFO);
		Map<String, Object> paramMap = new HashMap<String,Object>();
		paramMap.put("userId", userId);
		paramMap.put("tableNode", tableNode);
		return userDao.findUserById(paramMap);
	}
}
